Skip to main content
This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal

HCL Notes/Domino 8.5 Forum (includes Notes Traveler)

HCL Notes/Domino 8.5 Forum (includes Notes Traveler)

Previous Next
Subject: PInvoke and nnotes.dll
Feedback Type: Question
Product Area: Notes Client
Technical Area: Customization
Platform: Windows XP client
Release: 8.5
Reproducible: -Reproducibility-

Hi all,

I am writing an addin using a C++ bridge dll calling out to a managed C# dll. Using late binding I am able to get hold of the current notes session etc, but my problems start when I try and make calls to functions in the nnotes.dll.

I am using PInvoke to call out to the function OSPathNetConstruct. My declaration is as follows:

[DllImport("nnotes.dll", EntryPoint = "OSPathNetConstruct")]
public static extern UInt16 OSPathNetConstruct(Int64 PortName, String ServerName, String FileName, ref StringBuilder retPathName);

I then call it as follows:

StringBuilder mySB = new StringBuilder(1024);

OSPathNetConstruct(0, ServerName, FileName, ref mySB);

The code executes without error but my StringBuilder is always empty.

I tried replacing ref StringBuilder with an IntPtr in the declaration, and used it in the following way:

IntPtr ptr = Marshal.AllocCoTaskMem(1024);

OSPathNetConstruct(0, ServerName, FileName, ptr);

string s = Marshal.PtrToStringAuto(ptr);

This just returns a jumble of characters that make no sense what so ever.

Any help would be greatly appreciated.


Feedback number WEBB7TJEP2 created by ~Tanita Nimnimarli on 07/01/2009

Status: Open
Comments:





Printer-friendly

Search this forum

Member Tools


RSS Feeds

 RSS feedsRSS
All forum posts RSS
All main topics RSS